package com.movie.ticket.sale.cinemaApi;
import com.movie.ticket.sale.moviecommon.common.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@FeignClient(value = "cinema",contextId = "CinemaApi")
public interface CinemaApi {

    @PostMapping("test")
    void changeStringToSetStream(@RequestParam(value = "obj" )String obj);

    /**
     * 展示影院电影票房
     * @return
     */
    @GetMapping("data/acount")
    Result cinemaAcount();

    /**
     * 查看影院的订单信息
     * @param currPage
     * @param size
     * @param type ticket/vip  选择查询订单的类型
     * @param tradeNuo 订单号
     * @return
     */
    @GetMapping("findTicketOrder")
    Result findTicketOrder(@RequestParam(value = "currPage" ,defaultValue = "1")int currPage, @RequestParam(value = "size",defaultValue = "5")int size,@RequestParam(value = "type")String type, @RequestParam(value = "tradeNuo")String tradeNuo);


    /**
     * 查看当前影院的运营状态
     * @return
     */
    @GetMapping("state")
    Result showState();

    /**
     * 分页查询,模糊查询,查找所有的电影
     * @param currPage
     * @param size
     * @param name
     * @return
     */
    @GetMapping("myMovie/allMovie")
    Result findAllMovies(@RequestParam(value = "currPage" ,defaultValue = "1")int currPage, @RequestParam(value = "size",defaultValue = "5")int size,@RequestParam(value = "name")String name);

    /**
     * 分页查询,模糊查询,查找自己平台的电影
     * @param currPage
     * @param size
     * @param name
     * @return
     */
    @GetMapping("myMovie/findCinemaMovie")
    Result findCinemaMovie(@RequestParam(value = "currPage" ,defaultValue = "1")int currPage, @RequestParam(value = "size" ,defaultValue = "5")int size,@RequestParam(value = "name")String name);

    /**
     * 将电影关联到影院
     * @param movieId
     * @return
     */
    @PostMapping("myMovie/pullMovie")
    Result pullMovie(@RequestParam(value = "movieId")int movieId);

    /**
     * 将上架的电影进行下架
     * @param movieId
     * @return
     */
    @PutMapping("myMovie/soldOutCinemaMovie")
    Result soldOutCinemaMovie(@RequestParam(value = "movieId")int movieId);

    /**
     * 将上架的电影进行上架
     * @param movieId
     * @return
     */
    @PutMapping("myMovie/putawayCinemaMovie")
    Result putawayCinemaMovie(@RequestParam(value = "movieId")int movieId);


    /**
     * 分页查询影厅
     * @param currPage
     * @param size
     * @param type
     * @return
     */
    @GetMapping("auditorium/findAuditorium")
    Result findAuditorium(@RequestParam(value = "currPage",defaultValue = "1")int currPage, @RequestParam(value = "size",defaultValue = "5")int size,@RequestParam(value = "type")String type);

    /**
     * 新增影厅
     * @param name
     * @param type
     * @param seatCount
     * @param seatStream
     * @return
     */
    @PostMapping("auditorium/addAuditorium")
    Result addAuditorium(@RequestParam(value = "name")String name,@RequestParam(value = "type")String type,@RequestParam(value = "seatCount")int seatCount,@RequestParam(value = "seatStream")String seatStream);


    /**
     * 修改影厅信息
     * @param id 影厅id
     * @param name 影厅名
     * @param type 影厅类型
     * @param seatCount 影厅座位总数
     * @param seatStream 影厅座位信息
     * @param state 影厅状态
     * @return
     */
    @PutMapping("auditorium/updateAuditorium")
    Result updateAuditorium(@RequestParam(value = "id")int id,@RequestParam(value = "name")String name,@RequestParam(value = "type")String type,@RequestParam(value = "seatCount")int seatCount,@RequestParam(value = "seatStream")String seatStream,@RequestParam(value = "state")int state);

    /**
     * 新增vip规则
     * @param priceVar 决定价格的因子
     * @param tipDiscount 手续费折扣
     * @param ticketDiscount 票价折扣
     * @return
     */
    @PostMapping("vip/addVip")
    Result addVip(@RequestParam(value = "priceVar")int priceVar,@RequestParam(value = "tipDiscount")double tipDiscount,@RequestParam(value = "ticketDiscount")double ticketDiscount);

    /**
     * 分页查询vip会员规则，一级影院就查自己的id，二级影院查他的上级id
     * @param currPage
     * @param size
     * @param state 状态
     * @return
     */
    @GetMapping("vip/findVip")
    Result findVip(@RequestParam(value = "currPage",defaultValue = "1")int currPage, @RequestParam(value = "size",defaultValue = "5")int size,@RequestParam(value = "state")Integer state);


    /**
     * 修改vip规则
     * @param id 规则id
     * @param priceVar 决定价格的因子
     * @param tipDiscount 手续费折扣
     * @param ticketDiscount 票价折扣
     * @param state vip规则状态
     * @return
     */
    @PutMapping("vip/updateVip")
    Result updateVip(@RequestParam(value = "id")int id,@RequestParam(value = "priceVar")int priceVar,@RequestParam(value = "tipDiscount")double tipDiscount,@RequestParam(value = "ticketDiscount")double ticketDiscount,@RequestParam(value = "state")int state);

    /**
     * 删除vip规则
     * @param id
     * @return
     */
    @DeleteMapping("vip/delVip")
    Result delVip(@RequestParam(value = "id")int id);

    /**
     * 新增排片
     * @param movieId 选择的电影id
     * @param auditoriumId 选择的影厅id
     * @param startTime 开始时间
     * @param price 票价
     * @return
     */
    @PostMapping("plan/addPlan")
    Result addPlan(@RequestParam(value = "movieId")int movieId,@RequestParam(value = "auditoriumId")int auditoriumId,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "price")double price);

    /**
     * 分页条件查询场次
     * @param currPage 当前页
     * @param size 数量
     * @param state 状态
     * @param auditoriumId 影厅id
     * @param movieId 电影id
     * @return
     */
    @GetMapping("plan/findPlan")
    Result findPlan(@RequestParam(value = "currPage",defaultValue = "1")int currPage, @RequestParam(value = "size",defaultValue = "5")int size,@RequestParam(value = "state")Integer state,@RequestParam(value = "auditoriumId")Integer auditoriumId,@RequestParam(value = "movieId")Integer movieId);

    /**
     * 修改排片信息
     * @param id 场次id
     * @param movieId 电影id
     * @param auditoriumId 影厅id
     * @param startTime 开始时间
     * @param price 票价
     * @return
     */
    @PutMapping("plan/updatePlan")
    Result updatePlan(@RequestParam(value = "id")int id,@RequestParam(value = "movieId")int movieId,@RequestParam(value = "auditoriumId")int auditoriumId,@RequestParam(value = "startTime")String startTime,@RequestParam(value = "price")double price);

    /**
     * 根据id删除场次
     * @param id
     * @return
     */
    @DeleteMapping("plan/delPlan")
    Result delPlan(@RequestParam(value = "id")int id);


    /**
     * 查询影院的年费
     * @return
     */
    @GetMapping("annual/annualCost")
    Result annualCost();

    /**
     * 修改影院的信息
     * @param name 影院名
     * @param address 影院地址
     * @param tel 联系电话
     * @param service 支持的服务
     * @param file 影院主页的图片文件
     * @return
     */
    @PutMapping("update")
    Result updateCinema(@RequestParam(value = "name")String name, @RequestParam(value = "address")String address,@RequestParam(value = "tel")String tel,@RequestParam(value = "service")String service, @RequestParam(value = "file")MultipartFile file);





    /**
     * 关闭影院
     * @return
     */
    @PutMapping("close")
    Result closeCinema();

    /**
     * 用户取票，状态改为6（已取票）
     * @param checkCode 取票码
     * @return
     */
    @PutMapping("signIn")
    Result signIn(@RequestParam(value = "checkCode")String checkCode);





}
